#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/3/22 14:19
# @Author : 闫峰
# @File    : ceshi1.py

from common.setting import ensure_path_sep
from utils.mysqlUtils.db_pool import Database
from utils.logging_tool.init_logger import init_logger

INFO, ERROR, WARNING = init_logger()


class Test:


    def test__(self):
        db_java_test = Database(ensure_path_sep("\\config\\shopeev2_config.yaml.bak"), "test_jdw_database")
        get_data_list = """
        select source_id ,source_sku_deletion_set
    from test_zhcxkj_center_datasync_comprehensive.m_aliexpress_listing_pop_choice_product_monitor
        """
        data_list = db_java_test.fetch_all_tuple(get_data_list, ())
        for source_id, source_sku_deletion_set in data_list:
            data_list_1 = tuple(eval(source_sku_deletion_set))
            data_list_map = list(map(lambda x:(source_id,x),data_list_1))
            insert_sql = """
            insert INTO test_zhcxkj_center_datasync_comprehensive.m_aliexpress_listing_pop_choice_product_monitor1 
            (source_id, product_id)
            VALUES (%s,%s);
            """
            db_java_test.execute_many(insert_sql, data_list_map)


if __name__ == '__main__':
    Test().test__()